home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / www / cgi-bin / mailin-cgi < prev    next >
Encoding:
Text File  |  1996-11-11  |  4.0 KB  |  113 lines

  1. #!/usr/bin/perl
  2. # $Id: mailin-cgi,v 1.1 1996/02/15 19:57:11 dave Exp $
  3. #
  4. # user-comment - cgi script for mailing user-comment form output
  5. #
  6. # $Log: mailin-cgi,v $
  7. # Revision 1.1  1996/02/15  19:57:11  dave
  8. # adding in collapsed cgi-bin{int,ext,cd} files into their .m new forms
  9. #
  10. # Revision 1.1  1995/10/18  21:34:14  dave
  11. # Initial revision
  12. #
  13. # Revision 1.5  1995/05/01  15:52:42  dave
  14. # updating to escape ALL quoted @ signs as dan said perl 5 needs since reality results are in, as well as changing all occurences of dave@sgi.com with DTjanitor@sgi.com
  15. #
  16. # Revision 1.4  1995/02/25  01:13:53  dave
  17. # trying to clean up bad-style html forms (getting rid of press here stuff)
  18. #
  19. # Revision 1.2  1995/02/16  17:52:44  dave
  20. # modified to refer to cgi-lib.pl locally & added cgi-lib.pl local copy
  21. #
  22. # Revision 1.2  1995/01/31  18:38:42  dave
  23. # removed all references to http and/or ratmandu so things now simply reference document root and don't get machine-dependent
  24. #
  25. # Revision 1.1  1995/01/27  18:06:45  dave
  26. # Initial revision
  27. #
  28. #
  29.  
  30. require('cgi-lib.pl') || die "can\'t require cgi-lib.pl: $!";
  31.  
  32.  
  33. $request_method = $ENV{'REQUEST_METHOD'};
  34. $query_string = $ENV{'QUERY_STRING'};
  35. $path_info = $ENV{'PATH_INFO'};
  36. $content_length = $ENV{'CONTENT_LENGTH'};
  37. $ENV{'REQUEST_METHOD'} = "POST";
  38.  
  39. $recipient = $ARGV[0];
  40.  
  41. if (! $ARGV[0]) {
  42.     print "Content-type: text/html\n\n";
  43.  
  44.     # Oops
  45.     print "<Head><Title>form-mail error</Title></Head>";
  46.     print "<Body><H1>Oops</H1>";
  47.     print "The ACTION URL for this form is missing.  Pleeze send mail to";
  48.     print " <a href=\"mailto:DTjanitor\@sgi.com\"><b>DTjanitor\@sgi.com</b></a> to ";
  49.     print "inform the toolbox janitor he's an incompetant clown.";
  50.  
  51.     exit 0;
  52. }
  53. $recipient = 'DTjanitor\@sgi.com';
  54.  
  55.  
  56. &ReadParse();
  57.  
  58. if ($in{'email'} || $in{'name'} ) {
  59.     open(MAIL,"| /usr/lib/sendmail $recipient");
  60.     print MAIL "From: $in{'name'} <$in{'email'}>\nSubject: pheedbak re: $in{'relpath'}\n";
  61.     print MAIL "Date: `date`";
  62.     print MAIL "\n\n";
  63.     if ($in{'email'}) {
  64.         print MAIL "From: $in{'email'}\n";
  65.     } else {
  66.         print MAIL "Received from: $ENV{'REMOTE_USER'}\@$ENV{'REMOTE_HOST'}($ENV{'REMOTE_ADDR'})\n";
  67.     }
  68.     print MAIL "\n\n";
  69.     print MAIL "Email: $in{'email'}\n";
  70.     print MAIL "Name: $in{'name'}\n";
  71.     print MAIL "Subject: $in{'subject'}\n";
  72.     print MAIL "\n\nComments: $in{'comments'}\n";
  73.     print MAIL "\n\nrelative path == $in{'relpath'}\n";
  74.     print MAIL "\nfile they wuz in == $in{'fileWasIn'}\n\n\n";
  75.     print MAIL "Server protocol: $ENV{'SERVER_PROTOCOL'}\n";
  76.     print MAIL "Remote host: $ENV{'REMOTE_HOST'}\n";
  77.     print MAIL "Remote IP address: $ENV{'REMOTE_ADDR'}\n";
  78.  
  79.     close(MAIL);
  80. } else {
  81.     print STDOUT &PrintHeader;
  82.     print STDOUT "<HTTP>\n";
  83.     print STDOUT "<HEAD>\n";
  84.     print STDOUT "<TITLE>ERROR!</TITLE>\n";
  85.     print STDOUT "<H1>ERROR</H1>\n";
  86.     print STDOUT "</HEAD>\n";
  87.     print STDOUT "<BODY>\n";
  88.     print STDOUT "<h2>You must specify your e-mail address or your name!</H2>\n";
  89.     print STDOUT "</BODY>\n";
  90.     print STDOUT "</HTTP>\n";
  91.     exit 1;
  92. }
  93.  
  94. $back2start = "$in{'relpath'}/" . "$in{'fileWasIn'}";
  95. $urlline = "If you would like, you can <a href=$back2start>pick up where you left off</a> before accessing the Pheedbak link.\n";
  96.  
  97. print STDOUT &PrintHeader;
  98. print STDOUT "<html>\n";
  99. print STDOUT "<head>\n";
  100. print STDOUT "<title>SWANX!</title>\n";
  101. print STDOUT "</head>\n";
  102. print STDOUT "<body>\n";
  103. print STDOUT "<h3><a href=\"/toolbox/DT.html\">TOP</a> | <a href=\"/toolbox/DTtree.html\">Tree</a> | <a href=\"/toolbox/DTtopic.html\">Topic</a> | <a href=\"/toolbox/DTalfabetic.html\">A-Z</a> | <a href=\"/toolbox/www/cgi-bin/DTsearch-cgi\">Search</a> | <a href=\"/toolbox/DThot.html\">Hot</a> | <a href=\"/toolbox/DTnew.html\">New</a></h3><hr size=\"4\">";
  104. print STDOUT "<h1>SWANX!</h1>\n";
  105. print STDOUT "Your comments/suggestions/ideas/pheedbak <b>ARE ";
  106. print STDOUT "DEEPLY appreciated!</b><p>\n"; 
  107. print STDOUT "They have now been successfully sent on to the toolbox janitor.\n";
  108.  
  109. print STDOUT "<p>$urlline";
  110. print STDOUT "<hr size=\"4\">";
  111. print STDOUT "</body>\n";
  112. print STDOUT "</html>\n";
  113.